<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/layout/template.xhtml">
	<ui:define name="pageTitle">
		<h:outputText value="#{msg['page.title.incluir']}" />
	</ui:define>

	<ui:define name="content">
		<h:form>
		<p:messages id="messages" showDetail="false" autoUpdate="true" closable="true" />
			<fieldset style="margin: 10px 50px 20px;">
				<legend>Incluir Compromisso Agenda Parlamentar</legend>

				<label class="control-label" for="inputEmail">Nome do Parlamentar</label>
				<p:inputText id="nomeParlamentar" value="#{usuarioBean.obterUsuarioAtivo().nome}" styleClass="input-large" disabled="true" />

				<label class="control-label" for="inputEmail">Descrição</label>
 				<p:inputTextarea id="descricao" value="#{compromissoBean.compromisso.descricao}" styleClass="input-large" rows="5" cols="30" counter="descricaoDisplay"  maxlength="50" counterTemplate="{0} caracteres restantes." autoResize="false" />
    			<br/><h:outputText id="descricaoDisplay" style="font-size:0.8em; margin-left: 100px;" />

				<label class="control-label">Data e Hora de Inicio</label>
				<p:calendar id="dataInicio" value="#{compromissoBean.compromisso.dataInicio}" pattern="dd/MM/yyyy HH:mm" locale="pt_BR" styleClass="input-large" />

				<label class="control-label">Data e Hora do Término</label>
				<p:calendar id="dataTermino" value="#{compromissoBean.compromisso.dataTermino}" pattern="dd/MM/yyyy HH:mm" locale="pt_BR" styleClass="input-large" />

				<label class="control-label">Local</label>
				<p:inputText id="local" value="#{compromissoBean.compromisso.local}" />

				<label class="control-label">Prioridade</label>
				<p:selectOneRadio id="prioridade"
					value="#{compromissoBean.compromisso.prioridade}"
					styleClass="input-large">
					<f:selectItem itemLabel="Alta" itemValue="ALTA" />
					<f:selectItem itemLabel="Media" itemValue="MEDIA" />
					<f:selectItem itemLabel="Baixa" itemValue="BAIXA" />
				</p:selectOneRadio>

				<div class="control-group" style="margin-top: 50px;">
					<p:commandButton id="btnSalvar" value="Salvar" process="@this" rendered="#{not compromissoBean.mostraBotaoAlterar}"
						ajax="false" action="#{compromissoBean.incluirCompromisso}" update=":form:agendaParlamentarTable"
						styleClass="btn btn-info" />
						
					<p:commandButton id="btnAlterar" value="Alterar" process="@this" rendered="#{compromissoBean.mostraBotaoAlterar}"
						ajax="false" action="#{compromissoBean.alterarCompromisso}" update=":form:agendaParlamentarTable"
						styleClass="btn btn-info" />						
						
					<p:button value="#{msg['button.cancelar']}"  style="margin-left: 10px;"
					outcome="listarAgendaParlamentar" styleClass="btn btn-danger" />
				</div>
			</fieldset>



		</h:form>



	</ui:define>
</ui:composition>
</html>